// 导入express 文件
const fs = require('fs');
const http = require('http');
const path = require("path");
const https = require("https");
const express = require('express')

// Configuare https
// const httpsOption = {
//     key : fs.readFileSync("./b.tohturusul.cn.key"),
//     cert: fs.readFileSync("./b.tohturusul.cn_bundle.crt")
// }

// 创建应用实例
const app = express();

// const PORT = 80;  // HTTP 默认访问端口
// const SSLPORT = 443;  // HTTPS 默认访问端口
// let httpServer = http.createServer(app);
// let httpsServer = https.createServer(httpsOption, app);

// app.use('/public', express.static(path.join(__dirname,'./public')));

// 导入router
const router = require('./routes/routes');

//挂在实例中
app.use('/', router);

// 监听服务
app.listen(3000, () => {
    console.log('服务已启动...');
});
// httpServer.listen(PORT, function() {
//     console.log('HTTP Server is running on: http://localhost:%s', PORT);
// });
// httpsServer.listen(SSLPORT, function() {
//     console.log('HTTPS Server is running on: https://localhost:%s', SSLPORT);
// });
